<include file="Common:layout" />
<body style="background-color: rgb(255, 255, 255); overflow: auto; cursor: default;">
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>商品品牌管理</h3>
            </div>
        </div>
    </div>

    <div class="sDiv2">
        <form action="{:U('Brand/index')}" id="form" method="get">
            <input type="hidden" name="m" value="Admin">
            <input type="hidden" name="c" value="Brand">
            <input type="hidden" name="a" value="index">
            <select name="shop_id" style="width: 150px;">
                <option value="">所有店铺</option>
                <volist name="shops" id="shop">
                    <if condition="$shop['id'] eq $shop_id">
                        <option value="{$shop['id']}" selected>{$shop['shop_name']}</option>
                    <else/>
                        <option value="{$shop['id']}" >{$shop['shop_name']}</option>
                    </if>
                </volist>
            </select>
            <input type="submit" class="btn" name="btn" value="搜索">
        </form>
    </div>




    <form method="post">
        <input type="hidden" value="ok" name="form_submit">
        <div class="flexigrid">
            <div class="hDiv">
                <div class="hDivBox">
                    <table cellspacing="0" cellpadding="0">
                        <thead>
                        <tr>
                            <th align="center" axis="col1"><div style="text-align: left; width:60px;">ID</div></th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 180px;">品牌名称</div></th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 80px;">返利方式</div></th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 60px;">代理品牌</div></th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 120px;">品牌图片</div></th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 180px;">品牌描述</div></th>
                            <th align="center" axis="col2"><div style="text-align: center; width: 180px;">店铺名称</div></th>
                            <th align="center" axis="col3"><div style="text-align: center; width: 100px;">操作</div></th>
                            <th axis="col10"><div></div></th>
                        </tr>
                        </thead>
                    </table>
                </div>
            </div>
            <div class="tDiv">
                <div style="clear:both"></div>
            </div>
            <div style="height: auto;" class="bDiv">
                <table cellspacing="0" cellpadding="0" border="0" id="article_cat_table" class="flex-table autoht">
                    <tbody id="treet1">
                    <foreach name="brands" item="vo" key="k" >
                        <td class="sort">
                            <div style="text-align: center; width: 60px;">{$vo.id}</div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 180px;">
                            {$vo.b_name}
                            </div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 80px;">
                                <if condition="$vo['type_name'] neq ''">
                                    {$vo['type_name']}
                                <else/>
                                    无
                                </if>
                            </div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 60px;">
                                <if condition="$vo['agent_brand'] eq 1">
                                    是
                                <else/>
                                    否
                                </if>
                            </div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 120px;">
                                <a href="{$vo['pic']}" target="_blank"><img src="{$vo['pic']}" style="width: 30px;"></a>
                            </div>
                        </td>
                        <td class="name">
                            <div style="text-align: center; width: 180px;">
                                {$vo['info']|cut_str='35',###}
                            </div>
                        </td>

                        <td class="name">
                            <div style="text-align: center; width: 180px;">
                                {$vo['shop_name']}
                            </div>
                        </td>

                        <td>
                            <div style="text-align:left;width:100px!important; max-width:inherit !important;">
                                <if condition="$vo['agent_brand'] eq 1">
                                  <a href="{:U('Agent/rank', array('id'=>$vo['id']))}" class="del_spec btn blue"><i class="fa fa-search"></i>代理等级</a>
                                </if>
                            </div>
                        </td>


                        <td style="width: 100%;">
                            <div>&nbsp;</div>
                        </td>

                        </tr>
                    </foreach>
                    </tbody>
                </table>
                <br/>
            </div>
        </div>
    </form>
</div>
<script>
    $(document).ready(function(){

            $('.del_brand').click(function () {
                var _this = $(this);
                layer.confirm('您确认删除此品牌吗？', {
                    btn: ['确认','取消']
                }, function(){
                    $.ajax({
                        url: "{:U('Brand/del')}",
                        type: "post",
                        data: {
                          id: _this.attr('data-id')
                        },
                        beforeSend: function () {
                            //layer.msg('删除品牌中..', {icon: 16,time:500});
                        },
                        success: function (msg) {
                            //alert(msg);
                            if(msg == 1) {
                                window.location.href = "{:U('Brand/index')}";
                            } else {
                                layer.msg('修改失败!', {icon: 2,time:1000});
                            }
                            //msg==1 ? window.location.href = "{:U('Brand/index')}" : layer.msg('修改失败!', {icon: 2,time:1000});
                        }
                    });
                });
            });
    });


</script>
</body>
</html>